﻿using GalaSoft.MvvmLight;
using LiveChartsCore;
using LiveChartsCore.SkiaSharpView;
using LiveChartsCore.SkiaSharpView.Painting;
using SkiaSharp;
using System.Collections.Generic;
using System.Collections.ObjectModel;

namespace NaireSystem.ViewModels
{
    public class ViewModelNaireOverview : ViewModelBase
    {
        private ChartModel _Chart1 = new ChartModel();
        public ChartModel Chart1 { get => _Chart1; set => Set("Chart1", ref _Chart1, value); }

        private ChartModel _Chart2 = new ChartModel();
        public ChartModel Chart2 { get => _Chart2; set => Set("Chart2", ref _Chart2, value); }

        private ObservableCollection<ISeries> _ListPie = new ObservableCollection<ISeries>();
        public ObservableCollection<ISeries> ListPie { get { return _ListPie; } set { Set("ListPie", ref _ListPie, value); } }


        private ObservableCollection<ISeries> _ListPie_Dissatisfied = new ObservableCollection<ISeries>();
        public ObservableCollection<ISeries> ListPie_Dissatisfied { get { return _ListPie_Dissatisfied; } set { Set("ListPie_Dissatisfied", ref _ListPie_Dissatisfied, value); } }


        private ObservableCollection<ISeries> _ListPie_Normal = new ObservableCollection<ISeries>();
        public ObservableCollection<ISeries> ListPie_Normal { get { return _ListPie_Normal; } set { Set("ListPie_Normal", ref _ListPie_Normal, value); } }

        public ViewModelNaireOverview()
        {
            Chart1.ListSeries = new ObservableCollection<ISeries>
                                {
                                 new ColumnSeries<double>
                                 {
                                     IsHoverable = false, // disables the series from the tooltips 
                                     Values = new double[] { 100, 100, 100, 100, 100, 100, 100 },
                                     Stroke = null, 
                                     //#e9edf7
                                     Fill = new SolidColorPaint(new SKColor(0xe9, 0xed, 0xf7, 100)),
                                     IgnoresBarPosition = true
                                 },
                                 new ColumnSeries<double>
                                 {
                                     Name="哈哈",
                                     Values = new double[] { 3, 10, 5, 3, 7, 3, 8 },
                                     Stroke = null,
                                     MaxBarWidth=50,
                                     Fill = new SolidColorPaint(SKColors.CornflowerBlue),
                                     IgnoresBarPosition = true
                                 }
                         };

            Chart1.ListYAxis = new ObservableCollection<Axis>
                {
                    new Axis { MinLimit = 0, MaxLimit = 100 }
                };

            Chart2.ListSeries = new ObservableCollection<ISeries>
                                {
                                 new ColumnSeries<double>
                                 {
                                     Values = new double[] { 3, 10, 5, 3, 7, 3, 8 },
                                     Stroke = null,
                                     MaxBarWidth=50,
                                     Fill = new SolidColorPaint(SKColors.CornflowerBlue),
                                     IgnoresBarPosition = true
                                 }
                         };

            Chart2.ListYAxis = new ObservableCollection<Axis>
                {
                    new Axis { MinLimit = 0, MaxLimit = 100 }
                };

            ListPie = new ObservableCollection<ISeries>
    {
        new PieSeries<double> { Values = new List<double> { 2 }, InnerRadius = 150 },
        new PieSeries<double> { Values = new List<double> { 4 }, InnerRadius = 150 },
        new PieSeries<double> { Values = new List<double> { 1 }, InnerRadius = 150 },
        new PieSeries<double> { Values = new List<double> { 4 }, InnerRadius = 150 },
        new PieSeries<double> { Values = new List<double> { 3 }, InnerRadius = 150 }
    };
        }
    }



    public class ChartModel : ViewModelBase
    {

        private ObservableCollection<ISeries> _ListSeries = new ObservableCollection<ISeries>();
        public ObservableCollection<ISeries> ListSeries { get { return _ListSeries; } set { Set("ListSeries", ref _ListSeries, value); } }


        private ObservableCollection<Axis> _ListXAxis = new ObservableCollection<Axis>();
        public ObservableCollection<Axis> ListXAxis { get { return _ListXAxis; } set { Set("ListXAxis", ref _ListXAxis, value); } }


        private ObservableCollection<Axis> _ListYAxis = new ObservableCollection<Axis>();
        public ObservableCollection<Axis> ListYAxis { get { return _ListYAxis; } set { Set("ListYAxis", ref _ListYAxis, value); } }





    }
}
